<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<div>
<input type="text" name="user" id="">
<input type="password" name="pwd" id="">
<input type="submit" value="登录"  id="btn">
</div>
<script>
var btn=document.getElementById("btn");
var user=document.getElementsByTagName("input")[0];
var pwd=document.getElementsByTagName("input")[1];
btn.onclick=function (){
    console.log(user.value,pwd.value)
    if(user.value!=""&&pwd.value!="")
   location.href="index.html?user="+user.value+"&pwd="+pwd.value
}

</script>
</body>
</html>